package com.Cychat.AI.tools;

import com.Cychat.commons.entity.ResultMessage;
import com.Cychat.commons.entity.pojo.Pet;
import com.Cychat.commons.feign.PetFeignService;
import lombok.Data;
import org.springframework.ai.tool.annotation.Tool;
import org.springframework.ai.tool.annotation.ToolParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.w3c.dom.stylesheets.LinkStyle;

import java.util.List;

/**
 * Auther: 谢宝辉  <br/>
 * Date: 2025/11/4:17:06  <br/>
 * Description: 宠物工具类
 */
@Data
@Component
public class PetTools {
    private Long userId;
    @Autowired
    private PetFeignService petFeignService;

    @Tool(description = "根据宠物名称或者查询自己的宠物，给出宠物的详细描述")
    public ResultMessage<List<Pet>> getPetDescription(@ToolParam(description = "宠物名称") String petName){
        ResultMessage<List<Pet>> result = petFeignService.getPetsByUserId(userId);
        if(result.getData() == null){
            return ResultMessage.error("暂无宠物信息");
        }
        return result; // 直接返回封装后的结果
    }
}
